package time;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class time {
	
	
	public static void main(String[] args) throws ParseException {
//		Date date = new Date();
//		String today = date.toLocaleString();
//		//System.out.println(today);
//		SimpleDateFormat df =new SimpleDateFormat("yyyy-mm-dd");
//		String time = "1994-11-1";
//		try {
//			date = df.parse(time);
//			System.out.println(date.getTime()+"---"+date.getDate());
//		} catch (ParseException e) {
//			e.printStackTrace();
//		}
		
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		java.util.Date now;
		now = df.parse("2004-03-26 13:31:34");
		java.util.Date date=df.parse("2004-01-02 11:30:53");
		//new Date().toString()).getTime()
		//df.parse(new Date().toString()).getTime()-df.parse(rs.getString("b.btime")).getTime();
		long l=now.getTime()-date.getTime();
		long day=l/(24*60*60*1000);
		long hour=(l/(60*60*1000)-day*24);
		long min=((l/(60*1000))-day*24*60-hour*60);
		long s=(l/1000-day*24*60*60-hour*60*60-min*60);
		Date d = new Date();//生成当前日期
		d.getTime();//获取当前日期的时间戳
		System.out.println(d.getTime());
		System.out.println(""+day+"天"+hour+"小时"+min+"分"+s+"秒");	
		System.out.println((d.getTime()-df.parse("2015-12-14 18:30:53").getTime())/(24*60*60*1000));
	}
}
